<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<s:form action="getBannerStatistics" method="post" theme="simple" id="statusform">
<table width="100%">
	<tr>
		<td height="40" colspan="2" class="sectionheading bottom-border">
			<s:text name="Banner Advertiser Status" />
		</td>
	</tr>
	<tr>
		<td height="8" colspan="2">
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="100%" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td align="right">Please select a campaign to load report:</td>
					<td><s:select cssClass="Textfiled-border" name="bannerTypeId" list="banners" listValue="campaign" listKey="id" value="%{bannerTypeId}" theme="simple" /></td>
				</tr>
				<tr><td>&nbsp;</td></tr>
				<tr>
					<td align="right">Type:</td>
					<td><s:select theme="simple" cssClass="Textfiled-border"
							name="bannerReportType" value="%{bannerReportType}"
							list="#{'1':'Daily summary report', '2':'Hourly summary report'}" /> <!--  , '3':'View click log' -->
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td colspan="3" align="center">
			<s:submit theme="simple" type="image" src="../Admin-Images/submit-btn.gif" value="Submit" name="submit" />
			<img style="cursor: pointer;"
				onclick="document.getElementById('statusform').reset();"
				src="../Admin-Images/reset-button.gif" alt="Reset" title="Reset">
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td align="center">
			<s:if test="statusType == 'daily' && statisticsList.size > 0">
		 		Campaign daily report
		 	</s:if>
		 	<s:elseif test="statusType == 'hourly' && statisticsList.size > 0">
		 		Campaign hourly report
		 	</s:elseif>
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td>
			 <jsp:scriptlet>
			     org.displaytag.decorator.TotalTableDecorator totals = new org.displaytag.decorator.TotalTableDecorator();
			     totals.setTotalLabel("Total");
			     pageContext.setAttribute("totals", totals);
			  </jsp:scriptlet>

			
			 <display:table name="statisticsList" class="simple nocol" defaultsort="1" decorator="totals" pagesize="${pageSize}" requestURI="showCampaignsStatus.htm" id="row">
			 	<c:set var="count" value="${row_rowNum}" />
			 	<display:column title="#" headerClass="Table-Head">
					<c:out value="${row_rowNum}" />
				</display:column>
			 	<s:if test="statusType == 'daily' || statusType == null || statusType == ''">
			 		<display:column headerClass="Table-Head" title="Day">
			 			<s:date name="#attr.row.date" format="dd/MM/yyyy"/>
			 		</display:column>
			 	</s:if>
			 	<s:elseif test="statusType == 'hourly'">
			 		<display:column headerClass="Table-Head" title="Hour" >
			 			<s:date name="#attr.row.hour" format="HH:mm:ss" />
			 		</display:column>
			 	</s:elseif>
				<display:column headerClass="Table-Head" title="Clicks" property="clicks" format="{0,number,0}" total="true" />
				<display:column headerClass="Table-Head" title="Impressions" property="impression" format="{0,number,0}" total="true" />
			 </display:table>
		</td>
	</tr>
</table>
</s:form>